package FourArithmeticOperations;

/**
 * Created by dell on 2017/10/23.
 */
import java.util.Scanner;
public class BackPainExpert {
    private LinkedBinaryTree<String> tree;
    public BackPainExpert(){
                String e1 ="你？";
                String e2 ="你妈？";
                String e3 ="你爸？";
                String e4 ="你哥？";
                String e5 ="你弟？";
                String e6 ="你妹？";
                String e7 ="真相只有一个！是它！";
                LinkedBinaryTree<String> n2,n3,n4,n5,n6,n7,n8;
        n2 = new LinkedBinaryTree<String>(e2);
                n3 = new LinkedBinaryTree<String>(e3);
        n4 = new LinkedBinaryTree<String>(e4,n2,n3);
        n6 = new LinkedBinaryTree<String>(e6);
        n7 =new LinkedBinaryTree<String>(e7);
                n8 = new LinkedBinaryTree<String>(e5,n6,n7);
                tree = new LinkedBinaryTree<String>(e1,n4,n8);
    }
    public void diagnose(){
        Scanner scan = new Scanner(System.in);
        LinkedBinaryTree<String> current = tree;

        System.out.println("谁是凶手？");
        while (current.size()>1){
            System.out.println(current.getRootElement());
            if (scan.nextLine().equalsIgnoreCase("N"))
                current = current.getLeft();
            else
                current = current.getRight();
        }
        System.out.println(current.getRootElement());
    }
}
